package com.example.demo.controller;

import com.example.demo.service.TransactionService;
import com.example.demo.service.TransactionService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: demo
 * @description: 测试编程式事务
 * @author: 陈恩涛
 * @create: 2023-06-18 23:13
 **/

@RestController
@RequestMapping("/trx")
public class TransactionController {

    @Autowired
    private TransactionService transactionService;

    @Autowired
    private TransactionService2 transactionService2;

    @GetMapping("/t1")
    public String test01() {
        return transactionService.doProgrammaticTransaction();
    }

    @GetMapping("/t2")
    public String test02() {
        return transactionService2.doProgrammaticTransaction();
    }
}
